#include <Arduino.h>

const uint8_t led_pins[8] = {PA1, PA2, PA3, PA4, PA5, PA6, PA7, PA8};

void setup_led() {
    for (auto pin : led_pins) {
        pinMode(pin, OUTPUT);
        digitalWrite(pin, HIGH);
    }
}

void loop_led() {
    const uint32_t curr_millis = millis();
    static uint32_t pre_millis = 0;
    const uint32_t period = 500;
    if (curr_millis - pre_millis >= period) {
        pre_millis = curr_millis;
        static uint8_t i = 7;
        const uint8_t pre_i = i;
        i = (i + 1 + 8) % 8;

        digitalWrite(led_pins[pre_i], HIGH);
        digitalWrite(led_pins[i], LOW);
    }
}

void setup() {
    setup_led();
}

void loop() {
    loop_led();
}
